<template>
		<el-row>
		<el-col :span="4">
			<el-row>
				<el-col :span="7">诊治医生：</el-col>
				<el-col :span="12"><el-input placeholder="请输入内容" v-model="doctor" readonly=true></el-input></el-col>
			</el-row>
		</el-col>
		<el-col :span="4">
			<el-row>
				<el-col :span="7">发病时间：</el-col>
				<el-col :span="12"><el-input placeholder="请输入内容"></el-input></el-col>
			</el-row>
		</el-col>
		<el-col :span="4">
			<el-row>
				<el-col :span="7">诊治地点：</el-col>
				<el-col :span="12">
					<el-select v-model="handlePlace" placeholder="请选择">
						<el-option
						v-for="item in handlePlaces"
						:key="item.value"
						:label="item.label"
						:value="item.value">
					</el-option>
				</el-select>
			</el-col>
		</el-row>
	</el-col>
	<el-col :span="6">
		<el-row>
			<el-col :span="5">转诊医院：</el-col>
			<el-col :span="10">
				<el-select v-model="referralHospital" placeholder="请选择">
					<el-option-group
					v-for="group in referralHospitals"
					:key="group.label"
					:label="group.label">
					<el-option
					v-for="item in group.options"
					:key="item.value"
					:label="item.label"
					:value="item.value">
				    </el-option>
					</el-option-group>
				</el-select>
			</el-col>
			<el-col :span="9">
				<el-input v-show="isShowElse" placeholder="请输入其他医院" v-model="elseHospital"></el-input>
			</el-col>
		</el-row>
	</el-col>
</el-row>
</template>
<script type="text/javascript">
	export default{
		name:"HandleIndo",
		data(){
			return {
				isShowElse:false,
				elseHospital:'',
				referralHospital:'',
				doctor:'',
				handlePlace: '',
				handlePlaces:[{
					label: "门诊",
					value: "门诊"
				},{
					label: "出诊",
					value: "出诊"
				}],
				 referralHospitals: [{
          			label: '一级医院',
          			options: [{
            				value: 'Shanghai',
            				label: '一级医院AAA'
          				}, {
            				value: 'Beijing',
            				label: '一级医院BBB'
          			}]},{
          			label: '二级医院',
          			options: [{
            				value: 'Chengdu',
            				label: '二级医院AAA'
          				}, {
            				value: 'Shenzhen',
            				label: '二级医院BBB'
          				}]
        			},{
          			label: '三级医院',
          			options: [{
            				value: 'sanji1',
            				label: '三级医院AAA'
          				}, {
            				value: 'Shenzhen',
            				label: '三级医院BBB'
          				}]
        			},{
          			label: '其他',
          			options: [{
            				value: 'else',
            				label: '其他'
          				}]
        			}]
			}
		},
		created(){
			var curUser =  JSON.parse(localStorage.getItem('curUser'));
			if (curUser != null) {
				this.doctor = curUser.name;
			}else{
				//跳转到登录页面
				console.log("登录信息丢失，需要重新登录");
			}
		},
		watch:{
			referralHospital:{
				handler(curValue,oldValue){
					if (curValue == 'else') {
						this.isShowElse = true;
					}else{
						this.isShowElse = false;
					}
				}
			}

		}

	}
</script>
<style type="text/css" scoped>
	.el-row{
	margin-bottom: 5px;
	text-align: right;
	line-height: 40px;
}
</style>